import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
  linkActiveClass: 'yd-tabbar-active',
  linkExactActiveClass: 'yd-tabbar-active',
  routes: [
    //登录
    {
      path: '/login',
      name: 'login',
      component: () => import('@/pages/login/logins')
    },

    {
      path: '/register',
      name: 'register',
      component: () => import('@/pages/register/register')
    },

    //根目录
    {
      path: '/',
      name: 'index',
      component: () => import('@/pages/index/index.vue'),
      redirect: '/home',
      children: [
        {
          path: 'home',
          name: 'home',
          component: () => import('@/pages/home/index'),
          meta: {
            fixedBar: true
          } //此属性如果为true,则footer-nav显示, 否则不显示
        },

        // 组队页面---开始

        //下方导航，组队也难
        {
          path: 'formteam',
          name: 'formteam',
          component: () => import('@/pages/organize_team/formteam'),
          meta: {
            fixedBar: true
          }
        },
        // 商家列表页
        {
          path: 'team/:business_type',
          name: 'team',
          component: () => import('@/pages/organize_team/index'),
          meta: {
            fixedBar: false
          }
        },

        // 组队中商户进入的详情页
        {
          path: 'shcp_detail/:id',
          name: 'shcp_detail',
          component: () => import('@/pages/organize_team/shcp')
        },

        // 组队后邀请的页面
        {
          path: 'team_detail',
          name: 'team_detail',
          component: () => import('@/pages/organize_team/listteam')
        },
        //确认支付订单页
        {
          path: 'payment/:order_id',
          name: 'payment',
          component: () => import('@/pages/organize_team/payment')
        },
        //支付订单页
        {
          path: 'pay',
          name: 'pay',
          component: () => import('@/pages/organize_team/pay')
        },
        // 订单详情页
        {
          path: 'organize_order/:order_id',
          name: 'organize_order',
          component: () => import('@/pages/organize_team/order')
        },

        // 我的首页
        {
          path: 'user',
          name: 'user_index',
          component: () => import('@/pages/user/index'),
          meta: {
            fixedBar: true
          }
        },

        {
          path: 'mine',
          name: 'mine',
          component: () => import('@/pages/mine/index'),
          children: [
            // 我的订单
            {
              path: 'my_orders',
              name: 'my_orders',
              component: () => import('@/pages/mine/my_orders'),
              meta: {
                // title: '我的订单'
              }
            },

            // 银行卡
            {
              path: 'user_bank_card',
              name: 'user_bank_card',
              component: () => import('@/pages/mine/userBankCard')
            },
            // 绑定银行卡
            {
              path: 'bindCard',
              name: 'bindCard',
              component: () => import('@/pages/mine/bindCard')
            },
            // 提现记录
            {
              path: 'cashHistory',
              name: 'cashHistory',
              component: () => import('@/pages/mine/cashHistory'),
              meta: {
                title: '提现记录'
              }
            },
            // 提现
            {
              path: 'cash',
              name: 'cash',
              component: () => import('@/pages/mine/cash')
            },
            // 用户详细信息
            {
              path: 'mineInfoDetail',
              name: 'mineInfoDetail',
              component: () => import('@/pages/mine/mineInfoDetail'),
              meta: {
                title: '个人信息'
              }
            },

            // 我的分享
            {
              path: 'myShare',
              name: 'myShare',
              component: () => import('@/pages/mine/myShare'),
              meta: {
                title: '我的分享'
              }
            },
            // 我的评价
            {
              path: 'myComment',
              name: 'myComment',
              component: () => import('@/pages/mine/myComment'),
              meta: {
                title: '我的评价'
              }
            }
          ]
        },

        // 探店官页面
        {
          path: 'agentshop',
          name: 'agentshop',
          component: () => import('@/pages/user/agentshop'),
          meta: {
            fixedBar: false
          }
        },

        // 探店官申请
        {
          path: 'agentfor',
          name: 'agentfor',
          component: () => import('@/pages/user/agentfor'),
          meta: {
            fixedBar: false
          }
        },

        // 分享达人
        {
          path: 'share_person',
          name: 'share_person',
          component: () => import('@/pages/user/share'),
          meta: {
            fixedBar: false
          }
        },

        //分享达人申请
        {
          path: 'applyfor',
          name: 'applyfor',
          component: () => import('@/pages/user/applyfor'),
          meta: {
            fixedBar: false
          }
        },

        //分享达人申请
        {
          path: 'applyforBoss',
          name: 'applyforBoss',
          component: () => import('@/pages/user/applyforBoss'),
          meta: {
            fixedBar: false,
            title: '申请成为商家'
          }
        },

        // 余额充值
        {
          path: 'topup',
          name: 'topup',
          component: () => import('@/pages/user/topup'),
          meta: {
            fixedBar: false
          }
        },

        // 分享圈
        {
          path: 'share',
          name: 'share',
          component: () => import('@/pages/share'),
          meta: {
            fixedBar: true
          }
        },

        // 分享圈详情
        {
          path: 'shareDetail',
          name: 'shareDetail',
          component: () => import('@/pages/share/shareDetail')
        },

        // 商户
        {
          path: 'business',
          name: 'business',
          component: () => import('@/pages/business/index'),
          redirect: '/business/home',
          children: [
            {
              path: 'home',
              name: 'home',
              component: () => import('@/pages/business/home'),
              meta: {
                title: '我的商店'
              }
            },
            {
              path: 'goods',
              name: 'goods',
              component: () => import('@/pages/business/shopList')
            },
            {
              path: 'info',
              name: 'info',
              component: () => import('@/pages/business/shopInfo')
            },
            {
              path: 'goodsDetail',
              name: 'goodsDetail',
              component: () => import('@/pages/business/goodsDetail'),
              meta: {
                title: '商品信息'
              }
            },
            {
              path: 'data',
              name: 'data',
              component: () => import('@/pages/business/shopData'),
              meta: {
                title: '经营状况'
              }
            },
            {
              path: 'cuts',
              name: 'cuts',
              component: () => import('@/pages/business/cuts')
            },
            {
              path: 'cutDetail',
              name: 'cutDetail',
              component: () => import('@/pages/business/cutDetail'),
              meta: {
                title: '折扣信息'
              }
            }
          ]
        }
      ]
    }
  ]
});
